#简陋的MakeFile
lab2_name = semantic
lab3_name = interim
all: FLEX BISON CC
FLEX:
	flex -o lex.yy.c lexical.l
BISON: 
	bison -o syntax.tab.c -d -v syntax.y
CC: 
	gcc -c syntax.tab.c -o syntax.tab.o
	gcc -std=c99   -c -o $(lab3_name).o $(lab3_name).c
	gcc -std=c99   -c -o main.o main.c
	gcc -std=c99   -c -o $(lab2_name).o $(lab2_name).c
	gcc -o parser ./$(lab3_name).o ./main.o ./$(lab2_name).o ./syntax.tab.o -lfl -ly

.PHONY: clean test irsim once
clean: 
	rm -f lex.yy.c main.o $(lab2_name).o $(lab3_name).o syntax.output syntax.tab.c syntax.tab.o syntax.tab.h 
test:
	./parser ../test/test.c ../test/out.ir
	./parser ../test/test1.c ../test/out1.ir
	./parser ../test/test2.c ../test/out2.ir
	./parser ../test/test3.c ../test/out3.ir
	./parser ../test/test4.c ../test/out4.ir
	./parser ../test/test_struct_varible.c ../test/out_struct_varible.ir
	./parser ../test/test_high_dimension_array_varible.c ../test/out_high_dimension_array_varible.ir
	./parser ../test/test_struct_param.c ../test/out_struct_param.ir
	./parser ../test/test_array_param.c ../test/out_array_param.ir
irsim: 
	python ../simulator/irsim/irsim.pyc
once: all clean test
